import request from '@/utils/request';
import Qs from 'qs';

export interface LoginParamsType {
  userName: string;
  password: string;
  mobile: string;
  captcha: string;
}

export async function fakeAccountLogin(params: LoginParamsType) {
  return request('/v1/login', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
    },

    data: Qs.stringify(params, { arrayFormat: 'brackets' }),
    // paramsSerializer (param) {
    //   return Qs.stringify(param, { arrayFormat: 'brackets' })
    // },
  });
}

export async function getFakeCaptcha(mobile: string) {
  return request(`/api/login/captcha?mobile=${mobile}`);
}
